package com.sg.controller.bff;

import com.sg.service.biz.bff.RoleService;
import com.sg.dto.biz.bff.req.*;
import com.sg.dto.biz.bff.res.*;
import com.sg.common.ro.OkrResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Api(value = "Role", tags = {"Role"})
@RestController
// @RequestMapping("/oms/role/")
public class RoleController {

    @Autowired
    RoleService roleService;


    /**
     * B1-2查询角色详情（管理）
     * gen by moon at 8/10/2022, 3:35:40 AM
     */
    @PostMapping("/oms/mgt/role/queryRoleDetail")
    @ApiOperation(value = "B1-2查询角色详情（管理）", response = OkrResult.class)
    public OkrResult<BffQueryRoleDetailRespDto> queryRoleDetail(@RequestBody(required = false) @Validated BffQueryRoleDetailReqDto reqDTO) {
        return OkrResult.success(roleService.queryRoleDetail(reqDTO));
    }

    /**
     * B1-2查询自定义角色列表（管理）
     * gen by moon at 8/10/2022, 3:35:37 AM
     */
    @PostMapping("/oms/mgt/role/queryCustomRoleList")
    @ApiOperation(value = "B1-2查询自定义角色列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryCustomRoleListRespDto> queryCustomRoleList(@RequestBody(required = false) @Validated BffQueryCustomRoleListReqDto reqDTO) {
        return OkrResult.success(roleService.queryCustomRoleList(reqDTO));
    }

    /**
     * B1-2查询自定义角色详情（管理）
     * gen by moon at 8/10/2022, 3:32:03 AM
     */
    @PostMapping("/oms/mgt/role/queryCustomRoleDetail")
    @ApiOperation(value = "B1-2查询自定义角色详情（管理）", response = OkrResult.class)
    public OkrResult<BffQueryCustomRoleDetailRespDto> queryCustomRoleDetail(@RequestBody(required = false) @Validated BffQueryCustomRoleDetailReqDto reqDTO) {
        return OkrResult.success(roleService.queryCustomRoleDetail(reqDTO));
    }

    /**
     * B1-2修改自定义角色（管理）
     * gen by moon at 8/10/2022, 3:29:42 AM
     */
    @PostMapping("/oms/mgt/role/updateCustomRole")
    @ApiOperation(value = "B1-2修改自定义角色（管理）", response = OkrResult.class)
    public OkrResult<BffUpdateCustomRoleRespDto> updateCustomRole(@RequestBody(required = false) @Validated BffUpdateCustomRoleReqDto reqDTO) {
        return OkrResult.success(roleService.updateCustomRole(reqDTO));
    }


    /**
     * B1-2存档自定义角色（管理）
     * gen by moon at 8/10/2022, 3:37:15 AM
     */
    @PostMapping("/oms/mgt/role/archiveCustomRole")
    @ApiOperation(value = "B1-2存档自定义角色（管理）", response = OkrResult.class)
    public OkrResult<BffArchiveCustomRoleRespDto> archiveCustomRole(@RequestBody(required = false) @Validated BffArchiveCustomRoleReqDto reqDTO) {
        return OkrResult.success(roleService.archiveCustomRole(reqDTO));
    }
}
